]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
welcomeDialog: Adapt dialog title
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 27 Oct 2021 13:18:20 +0000 (15:18 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 18 Oct 2023 18:40:04 +0000 (18:40 +0000)
Use the downstream OS info if it's available, instead of hardcoding
the GNOME release.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7026
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2962>

js/ui/welcomeDialog.js

index d1b02b3aab719f860f8af1d8833e6f0d5868b14c..d6f682483e4fcced9488be80bd65e06b2d0935f5 100644 (file)
@@ -1,6 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
 import Clutter from 'gi://Clutter';
+import GLib from 'gi://GLib';
 import GObject from 'gi://GObject';
 import Shell from 'gi://Shell';
 import St from 'gi://St';
@@ -34,9 +35,22 @@ class WelcomeDialog extends ModalDialog.ModalDialog {
         return super.open();
     }
 
-    _buildLayout() {
+    _getOSName() {
+        const prettyName = GLib.get_os_info('PRETTY_NAME');
+        if (prettyName)
+            return prettyName;
+
+        const name = GLib.get_os_info('NAME');
+        const version = GLib.get_os_info('VERSION');
+        if (name)
+            return version ? `${name} ${version}` : name;
+
         const [majorVersion] = Config.PACKAGE_VERSION.split('.');
-        const title = _('Welcome to GNOME %s').format(majorVersion);
+        return _('GNOME %s').format(majorVersion);
+    }
+
+    _buildLayout() {
+        const title = _('Welcome to %s').format(this._getOSName());
         const description = _('If you want to learn your way around, check out the tour.');
         const content = new Dialog.MessageDialogContent({title, description});